import test.number.NumUtils;

public class Main {

    public static void main(String[] args) {

        test5();

//        test1();

//        System.out.println("Hello World!");

//        String phone = "13716071676";//137****1676
//        test1();

//        test2();

//        test3("11112222333344445555", "(\\d{4})\\d{12}(\\d{5})", "$1************$2");
//          $1,$3是占位符，
//           $1代表（.{4}）也就是0000   
//          (.*)代表任意字符            
//          $3代表 
//          (.{4}) 也就是后四们6321*/

//        String cardNum = "00005426321";
//        cardNum = cardNum.replaceAll("^(.{4})(.*)(.{4})$", "$1*****$3");
//        System.out.println(cardNum);

//        String cardNum = "0000111122223333444";//00001111222233334444
//        if (cardNum.trim().length() == 19) {
//            cardNum = cardNum.trim().replaceAll("(\\d{4})(\\d{12})(\\d{3})", "$1************$3");
//            System.out.println(cardNum);
//        } else {
//
//        }

    }

    private static void test5() {
        String cardNum = "0000111122223333444";//00001111222233334444
        String num = NumUtils.hideFrontalCardNum(cardNum);
        System.out.printf(num);
    }

    private static void test4() {
        String cardNum = "0000111122223333444";//00001111222233334444
        String num = NumUtils.hideCardNum(cardNum);
        System.out.printf(num);
    }


    private static void test3(String s, String s2, String s3) {
        String phone = s;
        String phoneNumber = phone.replaceAll(s2, s3);
        System.out.println("正则phone中4*：" + phoneNumber);
    }

    private static void test2() {
        String phone = "13123456789";
        String phoneNumber = phone.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2");
        System.out.println("正则phone中4*：" + phoneNumber);
    }

    private static void test1() {
        String phone = "13123456789";
        String phoneNumber = phone.substring(0, 3) + "****" + phone.substring(7, phone.length());
        System.out.println("phone总长度：" + phone.length());
        System.out.println("phone前3位：" + phone.substring(0, 3));
        System.out.println("phone中4位：" + phone.substring(3, 7));
        System.out.println("phone后4位：" + phone.substring(7, phone.length()));
        System.out.println("phone中4*：" + phoneNumber);
    }
}
